<!-- 分类授权编辑页面 -->
<extend name="Public/base" />

<block name="body">
<div class="main-title">
    <h2>权限管理</h2>
</div>
<div class="panel panel-default">
    <div class="panel-body">

        <div class="tab-wrap">
            <ul class="nav nav-tabs ">
                <li><a href="{:U('AuthManager/access',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">访问授权</a></li>
                <li class="active"><a href="javascript:;">分类授权</a></li>
                <li><a href="{:U('AuthManager/user',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">成员授权</a></li>
                <li class="fr">
                    <select name="group" class="form-control" >
                        <volist name="auth_group" id="vo">
                            <option value="{:U('AuthManager/category',array('group_name'=>$vo['title'],'group_id'=>$vo['id']))}" <eq name="vo['id']" value="$this_group['id']">selected</eq> >{$vo.title}</option>
                        </volist>
                    </select>
                </li>
            </ul>
            <!-- 分类授权 -->    
            <div class="tab-content panel-body">        
                <div class="table-responsive">	
                    <form  action="{:U('AuthManager/addToCategory')}" method="post" enctype="application/x-www-form-urlencoded"  class="form-inline save-category" role="form" >      
                        <input type="hidden" name="group_id" value="{:I('group_id')}"> 
                        <!--   分类管理/分类授权 树形菜单（支持多级）  --------------------------------------   -->
                        <div class="tree  category auth-category">
                            <ul>
                              {:R('AuthManager/tree', array($group_list))}   
                            </ul>     
                            <hr/>
                            <div class="tb-unit-bar">    
                                <button class="btn btn-default submit-btn ajax-post" type="submit" target-form="save-category">确 定</button>
                                <button class="btn btn-default btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                            </div>
                        </div>   
                    </form>             
                </div>
            </div>
        </div> 
    </div>
</div>		
</block>

<block name="style">
<load href="__CSS__/sb/tree.css" /> 
</block>

<block name="script">
<load href="__JS__/sb/tree.js" />
</block>

<script type="text/javascript">
+function($){
    var auth_groups = [{$authed_group}];
    $('.cate_id').each(function(){
        if( $.inArray( parseInt(this.value,10),auth_groups )>-1 ){
            $(this).prop('checked',true);
        }
    });
    $('select[name=group]').change(function(){
        location.href = this.value;
    });
}(jQuery);
//导航高亮
highlight_subnav('{:U('AuthManager/index')}');
</script> 
</block>
